package com.np.layout1;

import androidx.activity.result.ActivityResult;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ActivityResultLauncher<Intent> launcher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult>() {
            @Override
            public void onActivityResult(ActivityResult result) {

            }
        });

        findViewById(R.id.button_linear).setOnClickListener(v -> launcher.launch(new Intent(this, LinearLayoutActivity.class)));
        findViewById(R.id.button_relative).setOnClickListener(v -> launcher.launch(new Intent(this, RelativeLayoutActivity.class)));
        findViewById(R.id.button_absolute).setOnClickListener(v -> launcher.launch(new Intent(this, AbsoluteLayoutActivity.class)));
        findViewById(R.id.button_frame).setOnClickListener(v -> launcher.launch(new Intent(this, FrameLayoutActivity.class)));
        findViewById(R.id.button_table).setOnClickListener(v -> launcher.launch(new Intent(this, TableLayoutActivity.class)));
        findViewById(R.id.button_grid).setOnClickListener(v -> launcher.launch(new Intent(this, GridLayoutActivity.class)));
        findViewById(R.id.button_constraint).setOnClickListener(v -> launcher.launch(new Intent(this, ConstraintLayoutActivity.class)));
        findViewById(R.id.button_drawer).setOnClickListener(v -> launcher.launch(new Intent(this, DrawerLayoutActivity.class)));
    }
}